package org.panda.spring.beans;

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import org.panda.spring.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

@Component
public class OtherBean {

    @Bean("dataSource")
    public DataSource dataSource(
            @Value("${jdbc.driver}") String driverClassName,
            @Autowired UserDao userDao){
        DataSource  dataSource = new MysqlDataSource();
        System.out.println(driverClassName);
        System.out.println("dataSource: " + userDao);

        return dataSource;
    }
}
